package com.fhz.a2102shopjava.util;

import android.content.Context;
import android.graphics.drawable.Drawable;
import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
import com.bumptech.glide.request.RequestOptions;

/**
 * 时间:2023/8/15
 *
 * @author Mr.Feng
 * 简述: 图片加载框架
 */
public class ImageLoader {

    /**
     * 普通
     * @param context
     * @param url
     * @param imageView
     */
    public static void load(Context  context, String url, ImageView imageView){
        Glide.with(context).load(url).into(imageView);
    }

    /**
     * 圆角
     * @param context
     * @param url
     * @param imageView
     */
    public  static void loadCircleCorner(Context  context, String url, ImageView imageView){
        Glide.with(context)
                .load(url)
                .apply(RequestOptions.bitmapTransform(new RoundedCorners(30)))
                .into(imageView);
    }

    /**
     * 圆形
     * @param context
     * @param url
     * @param imageView
     */
    public  static void loadCircle(Context  context, String url, ImageView imageView){
        Glide.with(context)
                .load(url)
                .circleCrop()
                .into(imageView);
    }

    public  static void loadCircleDrawable(Context  context, int drawable, ImageView imageView){
        Glide.with(context)
                .load(drawable)
                .circleCrop()
                .into(imageView);
    }
}   
